[IA64] make virt_to_maddr() to support both cached/uncached identity mapped area.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Fri, 17 Oct 2008 06:33:03 +0000 (15:33 +0900)
committerIsaku Yamahata <yamahata@valinux.co.jp>
Fri, 17 Oct 2008 06:33:03 +0000 (15:33 +0900)
The significant 8 bits of va are used by Xen,
such as 0xf2 is used as uncache mapping.

In function ioports_permit_access,
 mach_start = mmio_start | __pa(space->mmio_base);
Mach_start gets wrong physical address.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
xen/include/asm-ia64/linux-xen/asm/pgtable.h
xen/include/asm-ia64/xenpage.h

index 2bc246726ef13c97cfad244072132753f936b3e8..adfd12a3bd7419e5ca034c5bf5e25649f29bf01b 100644 (file)
 #include <asm/system.h>
 #include <asm/types.h>
 #ifdef XEN
+#include <asm/xenpage.h>
 #ifndef __ASSEMBLY__
 #include <xen/sched.h> /* needed for mm_struct (via asm/domain.h) */
 #endif
 #endif
 
+#ifndef XEN
 #define IA64_MAX_PHYS_BITS     50      /* max. number of physical address bits (architected) */
+#endif
 
 /*
  * First, define the various bits in a PTE.  Note that the PTE format
index be9e2142b69c255dfcf6eea0ecb3fe2e237543a7..7425bc22c544738fd0b9b2090385832d77852a05 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _ASM_IA64_XENPAGE_H
 #define _ASM_IA64_XENPAGE_H
 
+/* moved from xen/include/asm-ia64/linux-xen/asm/pgtable.h to compile */
+#define IA64_MAX_PHYS_BITS     50      /* max. number of physical address bits (architected) */
+
 #ifndef __ASSEMBLY__
 #undef mfn_valid
 #undef page_to_mfn
@@ -23,7 +26,12 @@ static inline unsigned long __virt_to_maddr(unsigned long va)
        if (va - KERNEL_START < xenheap_size)
                return xen_pstart + (va - KERNEL_START);
        else
-               return (va & ((1UL << 60) - 1));
+               /* 
+                * Because the significant 8 bits of VA are used by Xen,
+                * and xen uses cached/uncached identity mapping.
+                * IA64_MAX_PHYS_BITS can't be larger than 56
+                */
+               return (va & ((1UL << IA64_MAX_PHYS_BITS) - 1));
 }
 
 #define virt_to_maddr(va)      (__virt_to_maddr((unsigned long)va))